using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.S_ModuleTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HLShop_ModuleTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HLShop_ModuleTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HLShop_Module";
			dataTableMapping.ColumnMappings.Add("id", "id");
			dataTableMapping.ColumnMappings.Add("name", "name");
			dataTableMapping.ColumnMappings.Add("IDName", "IDName");
			dataTableMapping.ColumnMappings.Add("CssName", "CssName");
			dataTableMapping.ColumnMappings.Add("NeedTitleHead", "NeedTitleHead");
			dataTableMapping.ColumnMappings.Add("Title", "Title");
			dataTableMapping.ColumnMappings.Add("TitleLink", "TitleLink");
			dataTableMapping.ColumnMappings.Add("NeedMoreLink", "NeedMoreLink");
			dataTableMapping.ColumnMappings.Add("MoreLinkUrl", "MoreLinkUrl");
			dataTableMapping.ColumnMappings.Add("NeedSummary", "NeedSummary");
			dataTableMapping.ColumnMappings.Add("Summary", "Summary");
			dataTableMapping.ColumnMappings.Add("Layout", "Layout");
			dataTableMapping.ColumnMappings.Add("ContentTemplate", "ContentTemplate");
			dataTableMapping.ColumnMappings.Add("Status", "Status");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HLShop_Module] WHERE (([id] = @Original_id))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_id", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "id", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HLShop_Module] ([name], [IDName], [CssName], [NeedTitleHead], [Title], [TitleLink], [NeedMoreLink], [MoreLinkUrl], [NeedSummary], [Summary], [Layout], [ContentTemplate], [Status]) VALUES (@name, @IDName, @CssName, @NeedTitleHead, @Title, @TitleLink, @NeedMoreLink, @MoreLinkUrl, @NeedSummary, @Summary, @Layout, @ContentTemplate, @Status)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "name", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@IDName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "IDName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@CssName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "CssName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@NeedTitleHead", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "NeedTitleHead", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@TitleLink", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "TitleLink", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@NeedMoreLink", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "NeedMoreLink", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@MoreLinkUrl", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "MoreLinkUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@NeedSummary", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "NeedSummary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Summary", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Summary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Layout", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Layout", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ContentTemplate", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ContentTemplate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "Status", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HLShop_Module] SET [name] = @name, [IDName] = @IDName, [CssName] = @CssName, [NeedTitleHead] = @NeedTitleHead, [Title] = @Title, [TitleLink] = @TitleLink, [NeedMoreLink] = @NeedMoreLink, [MoreLinkUrl] = @MoreLinkUrl, [NeedSummary] = @NeedSummary, [Summary] = @Summary, [Layout] = @Layout, [ContentTemplate] = @ContentTemplate, [Status] = @Status WHERE (([id] = @Original_id))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "name", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "IDName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@CssName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "CssName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@NeedTitleHead", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "NeedTitleHead", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@TitleLink", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "TitleLink", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@NeedMoreLink", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "NeedMoreLink", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@MoreLinkUrl", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "MoreLinkUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@NeedSummary", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "NeedSummary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Summary", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Summary", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Layout", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "Layout", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContentTemplate", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "ContentTemplate", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "Status", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_id", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "id", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[4];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT id, name, IDName, CssName, NeedTitleHead, Title, TitleLink, NeedMoreLink, \r\n      MoreLinkUrl, NeedSummary, Summary, Layout, ContentTemplate, Status\r\nFROM HLShop_Module order by id desc";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "DELETE FROM [HLShop_Module] WHERE (([id] = @id))";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "id", DataRowVersion.Original, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "SELECT ContentTemplate, CssName, IDName, Layout, MoreLinkUrl, NeedMoreLink, \r\n      NeedSummary, NeedTitleHead, Status, Summary, Title, TitleLink, id, name\r\nFROM HLShop_Module\r\nWHERE (id = @id)";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "id", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT TOP 1 ContentTemplate, CssName, IDName, Layout, MoreLinkUrl, NeedMoreLink, NeedSummary, NeedTitleHead, Status, Summary, Title, TitleLink, id, name FROM HLShop_Module WHERE (name = @Name)";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[3].Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "name", DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Module.HLShop_ModuleDataTable GetAllModule()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			S_Module.HLShop_ModuleDataTable hLShop_ModuleDataTable = new S_Module.HLShop_ModuleDataTable();
			this.Adapter.Fill(hLShop_ModuleDataTable);
			return hLShop_ModuleDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Module.HLShop_ModuleDataTable GetModuleById(int id)
		{
			this.Adapter.SelectCommand = this.CommandCollection[2];
			this.Adapter.SelectCommand.Parameters[0].Value = id;
			S_Module.HLShop_ModuleDataTable hLShop_ModuleDataTable = new S_Module.HLShop_ModuleDataTable();
			this.Adapter.Fill(hLShop_ModuleDataTable);
			return hLShop_ModuleDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual S_Module.HLShop_ModuleDataTable GetModuleByName(string Name)
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			if (Name == null)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = Name;
			}
			S_Module.HLShop_ModuleDataTable hLShop_ModuleDataTable = new S_Module.HLShop_ModuleDataTable();
			this.Adapter.Fill(hLShop_ModuleDataTable);
			return hLShop_ModuleDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_Module.HLShop_ModuleDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(S_Module dataSet)
		{
			return this.Adapter.Update(dataSet, "HLShop_Module");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
		[DataObjectMethod(DataObjectMethodType.Delete, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int DeleteModule(int id)
		{
			SqlCommand sqlCommand = this.CommandCollection[1];
			sqlCommand.Parameters[0].Value = id;
			ConnectionState state = sqlCommand.Connection.State;
			if ((sqlCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
			{
				sqlCommand.Connection.Open();
			}
			int result;
			try
			{
				result = sqlCommand.ExecuteNonQuery();
			}
			finally
			{
				if (state == ConnectionState.Closed)
				{
					sqlCommand.Connection.Close();
				}
			}
			return result;
		}
	}
}
